<?php

	require("includes/functions.php");
	$fname = $_POST['fname'];
	$lname = $_POST['lname'];
	$email = $_POST['email'];
	$uname = $_POST['uname'];
	$password = $_POST['spass'];
	$gender = $_POST['gender'];
	$month = ($_POST['month'] <10) ? "0".$_POST['month'] : $_POST['month'];
	$day = ($_POST['day'] <10) ? "0".$_POST['day'] : $_POST['day'];
	$year = $_POST['year'];
	$bday = $year."-".$month."-".$day;
	
	$imgtype=$_FILES['image']['type'];

		if($imgtype=="image/jpeg" || $imgtype=="image/jpg" || $imgtype=="image/png"){           
			$url=$_FILES['image']['name'];
		}
		
	move_uploaded_file($_FILES['image']['tmp_name'], 'user_images/' . $_FILES['image']['name']);
	
	$query = "INSERT INTO user_table (`firstName`, `lastName`, `email`,`username`,`password`,`gender`,`birthday`,`url`)
			VALUES('$fname', '$lname','$email','$uname','$password','$gender', '$bday','$url')";	  
									  
	mysql_query($query)or die(mysql_error());
	
	
	
?>
